package com.pattern.design.Chapter_11.Snippets;

import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.enterprise.event.Event;
import javax.inject.Inject;

import com.pattern.design.Chapter_11.com.devchronicles.observer.MessageEvent;

import javax.ejb.TransactionAttributeType;

@Stateless
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class EventService {
	@Inject
	private String message;
	@Inject
	@MessageEvent(MessageEvent.Type.SERVICE)
	Event<String> serviceEvent;
	@Inject
	@MessageEvent(MessageEvent.Type.PARAMETER)
	Event<String> parameterEvent;

	public void startService() {
		serviceEvent.fire("Starting service " + message);
		parameterEvent.fire("‐d ‐p");
	}
}